package yiqiyihui.com.orderquery.util;

import android.content.Context;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import yiqiyihui.com.orderquery.R;

/**
 * Created by Administrator on 2017/7/14.
 */

public class TitleBar extends LinearLayout implements View.OnClickListener {

    private TextView backBtn;
    private TextView refreshBtn;
    private ImageView imageView;
    /**
     * 构造方法
     * @param context
     */
    public TitleBar(Context context) {
        super(context);
    }

    public TitleBar(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    public TitleBar(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }


    /**
     * 初始化控件；
     */
    @Override
    protected void onFinishInflate() {
        super.onFinishInflate();
        backBtn=(TextView)findViewById(R.id.btnBack);
        refreshBtn=(TextView)findViewById(R.id.btnEdit);

    }

    /**
     * 点击事件
     * @param view
     */
    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.btnBack:
                break;
            case R.id.btnEdit:
                break;
        }

    }


    private void setState(){
        imageView= (ImageView) findViewById(R.id.title_bar_img);

        int statusBarHeight1 = -1;
        //获取status_bar_height资源的ID
        int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
        if (resourceId > 0) {
            //根据资源ID获取响应的尺寸值
            statusBarHeight1 = getResources().getDimensionPixelSize(resourceId);
        }
        //Log.e("wangX", "状态栏:" + statusBarHeight1);
        ViewGroup.LayoutParams params = imageView.getLayoutParams();
        params.height=statusBarHeight1;
        imageView.setLayoutParams(params);
    }

}
